// 为评论表模拟数据
require("../models/relation")
const { Op } = require("sequelize");
const mock = require("mockjs")
const {Comment} = require("../models/Comments")
const moment = require('moment');
const {RoomNo} = require("../models/RoomNo")
RoomNo.findAll({
    where:{
        roomResided:{
            [Op.gt]: 0
        }
    },
    offset:0,
    limit: 20
}).then(data => {
    const arr = JSON.parse(JSON.stringify(data))
    const RoomNoId = []
    arr.forEach(item => {
        RoomNoId.push(item.id)
    });
    const CommentList = mock.mock({
        "datas|20":[
            {
                "fraction":"@natural(50,100)",
                "comment":"@csentence(10,20)",
                "time":+moment.utc(),
                "RoomNoId|+1":RoomNoId,
                "AdminInfonId": 1
    
            }
        ]
    }).datas
    Comment.bulkCreate(CommentList).then(data => {
        console.log(data);
    })
})


